package com.young.ums.cloud.api.feign.fallback;

import com.young.interfaces.ums.model.*;
import com.young.ums.cloud.api.feign.IUmsOutServiceFeign;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;

/**
 * 降级实现
 * Created by Administrator on 2019/12/28 0028.
 */
@Component
public class UmsOutServiceFeignFallback implements IUmsOutServiceFeign {
    /**
     * 根据用户ID获取用户包含的资源列表
     *
     * @param userId
     * @return
     * @throws Exception
     */
    @Override
    public List<Navigate> getNavigateByUserId(@RequestParam(value = "userId") String userId) {
        return null;
    }

    /**
     * 根据用户id获取资源树(获取菜单),暂未实现
     *
     * @param userId
     * @return
     * @throws Exception
     */
    @Override
    public List<Navigate> getNavigateAsTreeByUserId(@RequestParam(value = "userId") String userId) {
        return null;
    }

    /**
     * 根据用户id获取用户登录信息
     *
     * @param userId
     * @return
     * @throws Exception
     */
    @Override
    public User getLoginUserById(@RequestParam(value = "userId") String userId) {
        return null;
    }

    /**
     * 验证单点,即验证token合法性
     *
     * @param token 令牌
     * @return
     * @throws Exception
     */
    @Override
    public SsoVerifyDTO verifySSO(@RequestParam(value = "token") String token) {
        return null;
    }

    /**
     * 查询用户上一次登录的时间
     *
     * @param userId
     * @return
     * @throws Exception
     */
    @Override
    public Date getLastLoginTime(@RequestParam(value = "userId") String userId) {
        return null;
    }

    /**
     * 根据组织id获取组织信息
     *
     * @param deptId
     * @return
     * @throws Exception
     */
    @Override
    public Dept getDeptById(@RequestParam(value = "deptId") String deptId) {
        return null;
    }

    /**
     * 根据角色id获取角色信息
     *
     * @param roleId
     * @return
     * @throws Exception
     */
    @Override
    public Role getRoleById(@RequestParam(value = "roleId") String roleId) {
        return null;
    }

    /**
     * 判断是否存在指定id/account的用户
     * 在创建用户之前做唯一性验证
     *
     * @param userIdOrAccount 用户id或者登陆账号
     * @return
     * @throws Exception
     */
    @Override
    public boolean existUserIdOrAccount(@RequestParam(value = "userIdOrAccount") String userIdOrAccount) {
        return false;
    }

    /**
     * 创建用户,供外部调用,id/account/companyId不允许为空
     *
     * @param user
     * @return
     * @throws Exception
     */
    @Override
    public boolean insertUser(@RequestBody User user) {
        return false;
    }

    /**
     * 更新用户信息
     *
     * @param user
     * @return int 改动的数据条数,-1表示操作失败
     * @throws Exception
     */
    @Override
    public int updateUser(@RequestBody User user) {
        return 0;
    }

    /**
     * 删除用户
     *
     * @param userId 用户id
     * @return int 改动的数据条数,-1表示操作失败
     * @throws Exception
     */
    @Override
    public int deleteUser(@RequestParam(value = "userId") String userId) {
        return 0;
    }

    /**
     * 校验用户是否有权限访问uri
     *
     * @param userId 用户id
     * @param uri    uri
     * @return
     */
    @Override
    public boolean canAccessUri(@RequestParam(value = "userId") String userId, @RequestParam(value = "uri") String uri) {
        System.out.println(11111);
        return false;
    }
}
